<?php

$GLOBALS['ServiceHandler']->attachRouter(array(
    	"Modules_InstalledList" => SERVICES_PATH.'Modules.php',
        "Modules_NotInstalledList" => SERVICES_PATH.'Modules.php',
        "Modules_AllList" => SERVICES_PATH.'Modules.php',
        "Modules_IsInstalled" => SERVICES_PATH.'Modules.php',
        "Modules_Install" => SERVICES_PATH.'Modules.php', 
        "Modules_Uninstall" => SERVICES_PATH.'Modules.php',                    
            
    ));


/*get routing from installed modules*/
$GLOBALS['callable']['beforeAll'][] = function() {
    
    $iMods = $GLOBALS['ServiceHandler']->call("Modules_InstalledList");
    
    foreach ($iMods as $mod) {
        require_once(MODULES_PATH.$mod['name'].'/services/routing.php');
        $fname = $mod['name'].'_routing';
        $rtr = $fname();
        $GLOBALS['ServiceHandler']->appendRouter($rtr);
    }
    
    
};